package com.zhan.ielts.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Properties;

public class CustomPropertisUtils {
	private static Properties pro = new Properties();
	static {
		try {
			String env = System.getProperty("resources_path");
			if (null == env) {
				env = System.getenv("resources_path");
			}
			InputStream in = CustomPropertisUtils.class.getResourceAsStream("/custom_"+env+".properties");
			pro.load(in);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static String getProperties(String key) {
		return pro.getProperty(key);
	}

	public static List<String> getList(String pName) {
		String p = CustomPropertisUtils.getProperties(pName);
		List<String> list = Arrays.asList(p.split(","));
		return list;
	}
}
